
package cn.edu.scau.cmi.hombio.web.rest;

import org.junit.Test;

import org.junit.runner.RunWith;

import org.springframework.beans.factory.annotation.Autowired;

import org.springframework.beans.factory.support.DefaultListableBeanFactory;

import org.springframework.context.ApplicationContext;

import org.springframework.mock.web.MockHttpServletRequest;
import org.springframework.mock.web.MockHttpServletResponse;

import org.springframework.test.context.ContextConfiguration;

import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;

import org.springframework.web.context.request.RequestContextHolder;
import org.springframework.web.context.request.RequestScope;
import org.springframework.web.context.request.ServletRequestAttributes;
import org.springframework.web.context.request.SessionScope;

/**
 * Unit test for the <code>FodderTypeRestController</code> controller.
 *
 * @see cn.edu.scau.cmi.hombio.web.rest.FodderTypeRestController
 */
@RunWith(SpringJUnit4ClassRunner.class)
@ContextConfiguration(locations = {
		"file:./resources/pigRs-security-context.xml",
		"file:./resources/pigRs-service-context.xml",
		"file:./resources/pigRs-dao-context.xml",
		"file:./resources/pigRs-web-context.xml" })
public class FodderTypeRestControllerTest {
	/**
	 * The Spring application context.
	 *
	 */
	private ApplicationContext context;

	/**
	 * Test <code>FodderTypefoddertype_idunit()</code>.
	 */
	@Test
	@SuppressWarnings("unused")
	public void GetFodderTypefoddertype_idunit() throws Exception {
		MockHttpServletRequest request = getMockHttpServletRequest();
		request.setRequestURI("/FodderType/{foddertype_id}/unit");
		MockHttpServletResponse response = getMockHttpServletResponse();

		// Get the singleton controller instance
		FodderTypeRestController controller = (FodderTypeRestController) context.getBean("FodderTypeRestController");

		// TODO Invoke method and Assert return values

	}

	/**
	 * Test <code>FodderTypefoddertype_idunit()</code>.
	 */
	@Test
	@SuppressWarnings("unused")
	public void PostFodderTypefoddertype_idunit() throws Exception {
		MockHttpServletRequest request = getMockHttpServletRequest();
		request.setRequestURI("/FodderType/{foddertype_id}/unit");
		MockHttpServletResponse response = getMockHttpServletResponse();

		// Get the singleton controller instance
		FodderTypeRestController controller = (FodderTypeRestController) context.getBean("FodderTypeRestController");

		// TODO Invoke method and Assert return values

	}

	/**
	 * Test <code>FodderTypefoddertype_idunit()</code>.
	 */
	@Test
	@SuppressWarnings("unused")
	public void PutFodderTypefoddertype_idunit() throws Exception {
		MockHttpServletRequest request = getMockHttpServletRequest();
		request.setRequestURI("/FodderType/{foddertype_id}/unit");
		MockHttpServletResponse response = getMockHttpServletResponse();

		// Get the singleton controller instance
		FodderTypeRestController controller = (FodderTypeRestController) context.getBean("FodderTypeRestController");

		// TODO Invoke method and Assert return values

	}

	/**
	 * Test <code>FodderTypefoddertype_idunitunit_id()</code>.
	 */
	@Test
	@SuppressWarnings("unused")
	public void DeleteFodderTypefoddertype_idunitunit_id() throws Exception {
		MockHttpServletRequest request = getMockHttpServletRequest();
		request.setRequestURI("/FodderType/{foddertype_id}/unit/{unit_id}");
		MockHttpServletResponse response = getMockHttpServletResponse();

		// Get the singleton controller instance
		FodderTypeRestController controller = (FodderTypeRestController) context.getBean("FodderTypeRestController");

		// TODO Invoke method and Assert return values

	}

	/**
	 * Test <code>FodderTypefoddertype_idunitunit_id()</code>.
	 */
	@Test
	@SuppressWarnings("unused")
	public void GetFodderTypefoddertype_idunitunit_id() throws Exception {
		MockHttpServletRequest request = getMockHttpServletRequest();
		request.setRequestURI("/FodderType/{foddertype_id}/unit/{unit_id}");
		MockHttpServletResponse response = getMockHttpServletResponse();

		// Get the singleton controller instance
		FodderTypeRestController controller = (FodderTypeRestController) context.getBean("FodderTypeRestController");

		// TODO Invoke method and Assert return values

	}

	/**
	 * Test <code>FodderTypefoddertype_idfeedTaskQualities()</code>.
	 */
	@Test
	@SuppressWarnings("unused")
	public void GetFodderTypefoddertype_idfeedTaskQualities() throws Exception {
		MockHttpServletRequest request = getMockHttpServletRequest();
		request.setRequestURI("/FodderType/{foddertype_id}/feedTaskQualities");
		MockHttpServletResponse response = getMockHttpServletResponse();

		// Get the singleton controller instance
		FodderTypeRestController controller = (FodderTypeRestController) context.getBean("FodderTypeRestController");

		// TODO Invoke method and Assert return values

	}

	/**
	 * Test <code>FodderTypefoddertype_idfeedTaskQualities()</code>.
	 */
	@Test
	@SuppressWarnings("unused")
	public void PostFodderTypefoddertype_idfeedTaskQualities() throws Exception {
		MockHttpServletRequest request = getMockHttpServletRequest();
		request.setRequestURI("/FodderType/{foddertype_id}/feedTaskQualities");
		MockHttpServletResponse response = getMockHttpServletResponse();

		// Get the singleton controller instance
		FodderTypeRestController controller = (FodderTypeRestController) context.getBean("FodderTypeRestController");

		// TODO Invoke method and Assert return values

	}

	/**
	 * Test <code>FodderTypefoddertype_idfeedTaskQualities()</code>.
	 */
	@Test
	@SuppressWarnings("unused")
	public void PutFodderTypefoddertype_idfeedTaskQualities() throws Exception {
		MockHttpServletRequest request = getMockHttpServletRequest();
		request.setRequestURI("/FodderType/{foddertype_id}/feedTaskQualities");
		MockHttpServletResponse response = getMockHttpServletResponse();

		// Get the singleton controller instance
		FodderTypeRestController controller = (FodderTypeRestController) context.getBean("FodderTypeRestController");

		// TODO Invoke method and Assert return values

	}

	/**
	 * Test <code>FodderTypefoddertype_idfeedTaskQualitiesfeedtaskquality_id()</code>.
	 */
	@Test
	@SuppressWarnings("unused")
	public void DeleteFodderTypefoddertype_idfeedTaskQualitiesfeedtaskquality_id() throws Exception {
		MockHttpServletRequest request = getMockHttpServletRequest();
		request.setRequestURI("/FodderType/{foddertype_id}/feedTaskQualities/{feedtaskquality_id}");
		MockHttpServletResponse response = getMockHttpServletResponse();

		// Get the singleton controller instance
		FodderTypeRestController controller = (FodderTypeRestController) context.getBean("FodderTypeRestController");

		// TODO Invoke method and Assert return values

	}

	/**
	 * Test <code>FodderTypefoddertype_idfeedTaskQualitiesfeedtaskquality_id()</code>.
	 */
	@Test
	@SuppressWarnings("unused")
	public void GetFodderTypefoddertype_idfeedTaskQualitiesfeedtaskquality_id() throws Exception {
		MockHttpServletRequest request = getMockHttpServletRequest();
		request.setRequestURI("/FodderType/{foddertype_id}/feedTaskQualities/{feedtaskquality_id}");
		MockHttpServletResponse response = getMockHttpServletResponse();

		// Get the singleton controller instance
		FodderTypeRestController controller = (FodderTypeRestController) context.getBean("FodderTypeRestController");

		// TODO Invoke method and Assert return values

	}

	/**
	 * Test <code>FodderTypefoddertype_idfodderStorages()</code>.
	 */
	@Test
	@SuppressWarnings("unused")
	public void GetFodderTypefoddertype_idfodderStorages() throws Exception {
		MockHttpServletRequest request = getMockHttpServletRequest();
		request.setRequestURI("/FodderType/{foddertype_id}/fodderStorages");
		MockHttpServletResponse response = getMockHttpServletResponse();

		// Get the singleton controller instance
		FodderTypeRestController controller = (FodderTypeRestController) context.getBean("FodderTypeRestController");

		// TODO Invoke method and Assert return values

	}

	/**
	 * Test <code>FodderTypefoddertype_idfodderStorages()</code>.
	 */
	@Test
	@SuppressWarnings("unused")
	public void PostFodderTypefoddertype_idfodderStorages() throws Exception {
		MockHttpServletRequest request = getMockHttpServletRequest();
		request.setRequestURI("/FodderType/{foddertype_id}/fodderStorages");
		MockHttpServletResponse response = getMockHttpServletResponse();

		// Get the singleton controller instance
		FodderTypeRestController controller = (FodderTypeRestController) context.getBean("FodderTypeRestController");

		// TODO Invoke method and Assert return values

	}

	/**
	 * Test <code>FodderTypefoddertype_idfodderStorages()</code>.
	 */
	@Test
	@SuppressWarnings("unused")
	public void PutFodderTypefoddertype_idfodderStorages() throws Exception {
		MockHttpServletRequest request = getMockHttpServletRequest();
		request.setRequestURI("/FodderType/{foddertype_id}/fodderStorages");
		MockHttpServletResponse response = getMockHttpServletResponse();

		// Get the singleton controller instance
		FodderTypeRestController controller = (FodderTypeRestController) context.getBean("FodderTypeRestController");

		// TODO Invoke method and Assert return values

	}

	/**
	 * Test <code>FodderTypefoddertype_idfodderStoragesfodderstorage_id()</code>.
	 */
	@Test
	@SuppressWarnings("unused")
	public void DeleteFodderTypefoddertype_idfodderStoragesfodderstorage_id() throws Exception {
		MockHttpServletRequest request = getMockHttpServletRequest();
		request.setRequestURI("/FodderType/{foddertype_id}/fodderStorages/{fodderstorage_id}");
		MockHttpServletResponse response = getMockHttpServletResponse();

		// Get the singleton controller instance
		FodderTypeRestController controller = (FodderTypeRestController) context.getBean("FodderTypeRestController");

		// TODO Invoke method and Assert return values

	}

	/**
	 * Test <code>FodderTypefoddertype_idfodderStoragesfodderstorage_id()</code>.
	 */
	@Test
	@SuppressWarnings("unused")
	public void GetFodderTypefoddertype_idfodderStoragesfodderstorage_id() throws Exception {
		MockHttpServletRequest request = getMockHttpServletRequest();
		request.setRequestURI("/FodderType/{foddertype_id}/fodderStorages/{fodderstorage_id}");
		MockHttpServletResponse response = getMockHttpServletResponse();

		// Get the singleton controller instance
		FodderTypeRestController controller = (FodderTypeRestController) context.getBean("FodderTypeRestController");

		// TODO Invoke method and Assert return values

	}

	/**
	 * Test <code>FodderTypefoddertype_idfodderTakes()</code>.
	 */
	@Test
	@SuppressWarnings("unused")
	public void GetFodderTypefoddertype_idfodderTakes() throws Exception {
		MockHttpServletRequest request = getMockHttpServletRequest();
		request.setRequestURI("/FodderType/{foddertype_id}/fodderTakes");
		MockHttpServletResponse response = getMockHttpServletResponse();

		// Get the singleton controller instance
		FodderTypeRestController controller = (FodderTypeRestController) context.getBean("FodderTypeRestController");

		// TODO Invoke method and Assert return values

	}

	/**
	 * Test <code>FodderTypefoddertype_idfodderTakes()</code>.
	 */
	@Test
	@SuppressWarnings("unused")
	public void PostFodderTypefoddertype_idfodderTakes() throws Exception {
		MockHttpServletRequest request = getMockHttpServletRequest();
		request.setRequestURI("/FodderType/{foddertype_id}/fodderTakes");
		MockHttpServletResponse response = getMockHttpServletResponse();

		// Get the singleton controller instance
		FodderTypeRestController controller = (FodderTypeRestController) context.getBean("FodderTypeRestController");

		// TODO Invoke method and Assert return values

	}

	/**
	 * Test <code>FodderTypefoddertype_idfodderTakes()</code>.
	 */
	@Test
	@SuppressWarnings("unused")
	public void PutFodderTypefoddertype_idfodderTakes() throws Exception {
		MockHttpServletRequest request = getMockHttpServletRequest();
		request.setRequestURI("/FodderType/{foddertype_id}/fodderTakes");
		MockHttpServletResponse response = getMockHttpServletResponse();

		// Get the singleton controller instance
		FodderTypeRestController controller = (FodderTypeRestController) context.getBean("FodderTypeRestController");

		// TODO Invoke method and Assert return values

	}

	/**
	 * Test <code>FodderTypefoddertype_idfodderTakesfoddertake_id()</code>.
	 */
	@Test
	@SuppressWarnings("unused")
	public void DeleteFodderTypefoddertype_idfodderTakesfoddertake_id() throws Exception {
		MockHttpServletRequest request = getMockHttpServletRequest();
		request.setRequestURI("/FodderType/{foddertype_id}/fodderTakes/{foddertake_id}");
		MockHttpServletResponse response = getMockHttpServletResponse();

		// Get the singleton controller instance
		FodderTypeRestController controller = (FodderTypeRestController) context.getBean("FodderTypeRestController");

		// TODO Invoke method and Assert return values

	}

	/**
	 * Test <code>FodderTypefoddertype_idfodderTakesfoddertake_id()</code>.
	 */
	@Test
	@SuppressWarnings("unused")
	public void GetFodderTypefoddertype_idfodderTakesfoddertake_id() throws Exception {
		MockHttpServletRequest request = getMockHttpServletRequest();
		request.setRequestURI("/FodderType/{foddertype_id}/fodderTakes/{foddertake_id}");
		MockHttpServletResponse response = getMockHttpServletResponse();

		// Get the singleton controller instance
		FodderTypeRestController controller = (FodderTypeRestController) context.getBean("FodderTypeRestController");

		// TODO Invoke method and Assert return values

	}

	/**
	 * Test <code>FodderType()</code>.
	 */
	@Test
	@SuppressWarnings("unused")
	public void GetFodderType() throws Exception {
		MockHttpServletRequest request = getMockHttpServletRequest();
		request.setRequestURI("/FodderType");
		MockHttpServletResponse response = getMockHttpServletResponse();

		// Get the singleton controller instance
		FodderTypeRestController controller = (FodderTypeRestController) context.getBean("FodderTypeRestController");

		// TODO Invoke method and Assert return values

	}

	/**
	 * Test <code>FodderTypefoddertype_id()</code>.
	 */
	@Test
	@SuppressWarnings("unused")
	public void GetFodderTypefoddertype_id() throws Exception {
		MockHttpServletRequest request = getMockHttpServletRequest();
		request.setRequestURI("/FodderType/{foddertype_id}");
		MockHttpServletResponse response = getMockHttpServletResponse();

		// Get the singleton controller instance
		FodderTypeRestController controller = (FodderTypeRestController) context.getBean("FodderTypeRestController");

		// TODO Invoke method and Assert return values

	}

	/**
	 * Test <code>FodderType()</code>.
	 */
	@Test
	@SuppressWarnings("unused")
	public void PutFodderType() throws Exception {
		MockHttpServletRequest request = getMockHttpServletRequest();
		request.setRequestURI("/FodderType");
		MockHttpServletResponse response = getMockHttpServletResponse();

		// Get the singleton controller instance
		FodderTypeRestController controller = (FodderTypeRestController) context.getBean("FodderTypeRestController");

		// TODO Invoke method and Assert return values

	}

	/**
	 * Test <code>FodderType()</code>.
	 */
	@Test
	@SuppressWarnings("unused")
	public void PostFodderType() throws Exception {
		MockHttpServletRequest request = getMockHttpServletRequest();
		request.setRequestURI("/FodderType");
		MockHttpServletResponse response = getMockHttpServletResponse();

		// Get the singleton controller instance
		FodderTypeRestController controller = (FodderTypeRestController) context.getBean("FodderTypeRestController");

		// TODO Invoke method and Assert return values

	}

	/**
	 * Test <code>FodderTypefoddertype_id()</code>.
	 */
	@Test
	@SuppressWarnings("unused")
	public void DeleteFodderTypefoddertype_id() throws Exception {
		MockHttpServletRequest request = getMockHttpServletRequest();
		request.setRequestURI("/FodderType/{foddertype_id}");
		MockHttpServletResponse response = getMockHttpServletResponse();

		// Get the singleton controller instance
		FodderTypeRestController controller = (FodderTypeRestController) context.getBean("FodderTypeRestController");

		// TODO Invoke method and Assert return values

	}

	/**
	 * Autowired to set the Spring application context.
	 *
	 */
	@Autowired
	public void setContext(ApplicationContext context) {
		this.context = context;
		((DefaultListableBeanFactory) context.getAutowireCapableBeanFactory()).registerScope("session", new SessionScope());
		((DefaultListableBeanFactory) context.getAutowireCapableBeanFactory()).registerScope("request", new RequestScope());
	}

	/**
	 * Returns a mock HttpServletRequest object.
	 *
	 */
	private MockHttpServletRequest getMockHttpServletRequest() {
		MockHttpServletRequest request = new MockHttpServletRequest();
		ServletRequestAttributes attributes = new ServletRequestAttributes(request);
		RequestContextHolder.setRequestAttributes(attributes);
		return request;
	}

	/**
	 * Returns a mock HttpServletResponse object.
	 *
	 */
	private MockHttpServletResponse getMockHttpServletResponse() {
		return new MockHttpServletResponse();
	}
}